<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>鼠标滑过过渡效果</title>
  <style>
    html,
    body {
      padding: 0;
      margin: 0;
    }

    ul,
    li {
      list-style: none;
    }

    a {
      text-decoration: none;
      color: #000;
    }

    .container {
      padding: 20px;
      width: 100%;
    }

    ul li {
      float: left;
      position: relative;
      width: 100px;
      line-height: 60px;
      margin: 0 5px;
      text-align: center;
    }

    ul li a {
      display: block;
    }

    ul li a:hover,
    ul li a:active {
      color: #59c7f9;
    }

    ul li a:hover:before,
    ul li a:active:before {
      -webkit-transform: scaleX(1);
      transform: scaleX(1);
    }

    ul li a:before {
      position: absolute;
      width: 100%;
      height: 0;
      left: 0;
      bottom: -1px;
      content: '';
      border-bottom: 2px solid #59c7f9;
      -webkit-transform: scaleX(0);
      transform: scaleX(0);
      -webkit-transition: -webkit-transform .25s ease;
      transition: transform .25s ease;
    }
  </style>
</head>

<body>
  <div class="container">
    <ul>
      <li>
        <a href="javascript:void(0)">首页</a>
      </li>
      <li>
        <a href="javascript:void(0)">首页</a>
      </li>
      <li>
        <a href="javascript:void(0)">首页</a>
      </li>
      <li>
        <a href="javascript:void(0)">首页</a>
      </li>
    </ul>
  </div>
</body>

</html>